package dr.moteur;

import java.awt.Graphics;
import java.awt.Color;
import java.io.Serializable;

import javax.vecmath.Vector2f;
import data.Game;

public class Zone implements Serializable{
	/*Attributs*/
	private Vector2f coinHG;
	private Vector2f coinBD;
	
	/*Constructeur*/
	public Zone(Vector2f coinHG, Vector2f coinBD){
		this.coinHG=new Vector2f(coinHG);
		this.coinBD=new Vector2f(coinBD);
	}
	
	/*Getters & Setters*/
	public Vector2f getCoinHG() {
		return coinHG;
	}
	public void setCoinHG(Vector2f coinHG) {
		this.coinHG = coinHG;
	}
	public Vector2f getCoinBD() {
		return coinBD;
	}
	public void setCoinBD(Vector2f coinBD) {
		this.coinBD = coinBD;
	}
	
	/*Methodes*/
	public void seDessiner(Graphics g, String type){

	    if (Game.debug_display) System.out.println("ZONE DESSINEE ("+coinHG.x+";"+coinHG.y+"), ("+coinBD.x+";"+coinBD.y+") => "+(int)(coinHG.x)+" "+(int)(coinHG.y)+" : "+(int)(coinBD.x-coinHG.x)+" "+(int)(coinBD.y-coinHG.y));
	    g.setColor(new Color(0.7f,0.7f,1.0f,0.5f));
	    if (type == "mini"){ //PAS TEXTURE
	    	
	    	float coef = (float) (150.0/1675);

			//System.out.println("init x:"+x+" init y:"+y);
			//System.out.println(coef);
			//System.out.println("x:"+(coef*x)+" y:"+(coef*y));
			g.fillRect((int)((coef*coinHG.x)-5/2), (int)((coef*coinHG.y)-5/2), (int)(coef*(coinBD.x-coinHG.x)), (int)(coef*(coinBD.y-coinHG.y)));

		    	
	    }else{ // TEXTURE
	    	
	    	g.fillRect((int)(coinHG.x), (int)(coinHG.y), (int)(coinBD.x-coinHG.x), (int)(coinBD.y-coinHG.y));
	    }
		
	}
}
